package day07;

import java.util.Scanner;

/**
 * Created by Shinelon on 2016/9/20.
 */
public class Bank {
    public static void main(String[] args) {
        Card card = new NYYHCard();
        Scanner scan=new Scanner(System.in);
        while (true) {
            System.out.println("1,工商 2，建设 3，农业 4,退出");
            int banky=scan.nextInt();
            if (banky==4){
                System.out.println("回家");
                break;
            }
            ATM atm = null;
            switch (banky){
                case 1:
                    atm = new ICBC();
                    break;
                case 2:
                    atm= new JSYH();
                    break;
                case 3:
                    atm=new NYYH();
                    break;
            }

            while (true) {
                System.out.println("欢迎使用" + atm.getName() + "ATM机\n 1,查询余额 2，取现 3，存钱 " + atm.getMenu() + " 5，退出");


                int read = atm.scan.nextInt();
                switch (read) {
                    case 1:
                        atm.getBalance(card);
                        break;
                    case 2:
                        atm.getMoney(card);
                        break;
                    case 3:
                        atm.cunMoney(card);
                        break;
                    case 4:
                        atm.other(card);
                }
                if (read == 5) {
                    atm.exit(card);
                    break;
                }
            }
        }
    }
}